package models

type Cart struct {
	Id             int
	Title          string
	Price          float64
	ProductVersion string
	Num            int
	ProductGift    string
	ProductFitting string
	ProductColor   string
	ProductImg     string
	ProductAttr    string
	Checked        bool `gorm:"-`
}

func (Cart) TableName() string {
	return "cart"
}

func CartHasData(cartlist []Cart, cartdata Cart) bool {
	for i := 0; i < len(cartlist); i++ {
		if cartlist[i].Id == cartdata.Id &&
			cartlist[i].ProductColor == cartdata.ProductColor &&
			cartlist[i].ProductAttr == cartdata.ProductAttr {
			return true
		}
	}
	return false
}
